package com.example.javademo.Utils;


/**
 * @作者 江南一点雨
 * @公众号 江南一点雨
 * @微信号 a_java_boy
 * @GitHub https://github.com/lenve
 * @博客 http://wangsong.blog.csdn.net
 * @网站 http://www.javaboy.org
 * @时间 2019-09-20 8:39
 */
public class Response {
    private Integer code;
    private String msg;
    private Object data;

    public static Response build() {
        return new Response();
    }

    public static Response ok(String msg,Object data) {
        return new Response(0, msg, data);
    }


    public static Response okMsg(String msg,Object data) {
        return new Response(1, msg, data);
    }

    public static Response error(String msg) {
        return new Response(-1, msg, null);
    }
    public static Response errorMsg(String msg) {
        return new Response(-2, msg, null);
    }

    private Response() {
    }

    private Response(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public Response setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public Response setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public Object getData() {
        return data;
    }

    public Response setData(Object data) {
        this.data = data;
        return this;
    }
}
